. _
[Server]

Container Setup

1. Main Directory

first step is to create a path /server-server

      
bash
mkdir /server-server

To give all permissions to all the users:

      
bash
sudo chmod -R a+rwx /server-server

To give ownership of a directory to a specific user and group, use chown:

      
bash
sudo chown -R username:groupname /folder_path

For our usecase, to set the owner to user danial and group sudo on /server-server:

      
bash
sudo chown -R danial:sudo /server-server

2. Portainer

create a directory inside portainer:

      
bash
mkdir portainer cd portainer touch docker-compose.yml

docker-compose.yml:

      
yaml
version: "3" services: portainer: image: portainer/portainer-ce:latest container_name: portainer ports: - 8000:8000 - 9000:9000 - 9443:9443 volumes: - ./portainer_data:/data - /var/run/docker.sock:/var/run/docker.sock restart: always
      
bash
docker compose -f docker-compos.yml up -d

NOTE:
set the Public IP in the setting for easier use later
Home -> Environment details -> Public IP



NOTE:
remember to setup SSL certificate in the setting after nginx is setup


3. NGINX proxy manager

clone the gateway repo and cd to it .

if you chenout DOCKER_NETWORKS.md it will explain what commands to run and how to connects other containers to the same network as nginx

to setup the networks run:

      
bash
chmod +x setup-networks.sh ./setup-networks.sh

to start the nginx run:

      
bash
docker compose -f docker-compos-nginx.yml up -d

after create user and login to nginx , go to :

Settings -> Default Site -> Select Custom HTML

      
html
<!DOCTYPE html> <html> <head> <style type=text/css> * { -webkit-box-sizing: border-box; box-sizing: border-box; } body { padding: 0; margin: 0; } #notfound { position: relative; height: 100vh; } #notfound .notfound { position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } .notfound { max-width: 520px; width: 100%; line-height: 1.4; text-align: center; } .notfound .notfound-error { position: relative; height: 200px; margin: 0px auto 20px; z-index: -1; } .notfound .notfound-error h1 { font-family: 'Montserrat', sans-serif; font-size: 200px; font-weight: 300; margin: 0px; color: #211b19; position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } @media only screen and (max-width: 767px) { .notfound .notfound-error h1 { font-size: 148px; } } @media only screen and (max-width: 480px) { .notfound .notfound-error { height: 148px; margin: 0px auto 10px; } .notfound .notfound-error h1 { font-size: 120px; font-weight: 200px; } .notfound .notfound-error h2 { font-size: 30px; } .notfound a { padding: 7px 15px; font-size: 24px; } .h2 { font-size: 148px; } } </style> </head> <body> <div id="notfound"> <div class="notfound"> <h1>Sorry the page can't be loaded!</a></h1> <div class="notfound-error"> <p>Contact the site's administrator or support for assistance.</p> </div> </div> </div> </body> </html>

4. beszel

create a directory inside portainer:

      
bash
mkdir beszel cd beszel touch docker-compose.yml

docker-compose.yml:

      
yaml
version: '3' services: beszel: image: henrygd/beszel container_name: beszel restart: unless-stopped ports: - 8090:8090 volumes: - ./beszel_data:/beszel_data networks: - internal networks: internal: external: name: server_internal

after create user and login , to create an agent go to :

Add System -> Docker Compose dropdown -> Copy Docker run

then paste the docker command in the server's terminal and then click Add System

0%